package org.deng.learn.designpattern.state;

/**
 * @author DengLibin
 * @Description 聊天客户端
 * @Date 2019/3/14 0014 16:03
 */
public class MsgClient {
    private ClientState clientState; //当前客户端的状态
    private String username;//用户账号
    public   MsgClient(ClientState clientState, String username){
        this.clientState = clientState;
        this.username = username;
    }

    /**
     * 显示聊天窗口
     */
    public void showChatForm(){
        this.clientState.showChatForm();
    }

    /**
     * 发消息
     * @param msg
     * @param receiver
     */
    public  void sendMsg(String msg, String receiver){
        this.clientState.sendMsg(msg, receiver);
    }
    public ClientState getClientState() {
        return clientState;
    }

    public void setClientState(ClientState clientState) {
        this.clientState = clientState;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
}
